package com.heima.job;

import com.heima.feign.ArticleFeignClient;
import com.heima.model.common.dtos.ResponseResult;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * XXL-Job 将5天内的热门文章定时存储到Redis（未删除 未下架 30条）
 * @author chenshan
 */
@Component
public class ArticleXXLJob {

    @Autowired
    private ArticleFeignClient articleFeignClient;

    @XxlJob("computeHotArticleJob")
    public void helloJob(){
        ResponseResult result = articleFeignClient.selectFiveDaysArticle();
        if (result.getCode() == 200) {
            System.out.println("success");
        }
    }
}